package team.xstudio.bedwarstoolkit.ingame

import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.entity.player.Player
import kotlin.jvm.optionals.getOrNull

/**
 * Created in 2025/6/10
 * Project: bedwarstoolkit
 *
 * @author <a href="https://github.com/Bread-Nicecat">Bread_NiceCat</a>
 * <p>
 *
 * <p>
 **/
class BWGameInstance internal constructor(
    val id: Int,
    val teams: Set<BWGameTeam>,
) {
    fun getTeamByPlayer(player: Player): BWGameTeam? =
        teams.stream().filter { it.hasPlayer(player) }.findFirst().getOrNull()

    fun serverTick(sky: ServerLevel) {
    }

    fun tickPlayer(player: ServerPlayer) {
    }

    fun hasPlayer(player: Player) = getTeamByPlayer(player) != null
}